#ifndef CONIOLOG_HELPER_H
#define CONIOLOG_HELPER_H

#include <iostream>
#include <string>

namespace GoldenAges
{
    class LogUtility
    {
    public:
        enum MessageMode
        {
            MM_NONE,
            MM_INFO = 1 << 1,
            MM_WARN = 1 << 2,
            MM_ERROR = 1 << 3,
            MM_EXCEPTION = 1 << 4,
            MM_ASSERTFAIL = 1 << 5,
            MM_DEBUGMSG = 1 << 7,
            MM_ALL = MM_INFO | MM_WARN | MM_ERROR | MM_EXCEPTION | MM_ASSERTFAIL
                | MM_DEBUGMSG
        };

        static void Log(const std::string &sMessage, MessageMode mmMode = MM_NONE)
        {
#ifndef _DEBUG
            if((mmMode & MM_ASSERTFAIL) || (mmMode & MM_DEBUGMSG))
                return;
#endif
            if(mmMode & MM_INFO)
                fprintf(stdout, "\x1b[34m");                 // niebieski
            if(mmMode & MM_WARN)
                fprintf(stdout, "\x1b[1m\x1b[33m");          // bold & zolty
            if(mmMode & MM_ERROR)
                fprintf(stdout, "\x1b[1m\x1b[31m");          // bold & czerwony
            if(mmMode & MM_EXCEPTION)
                fprintf(stdout, "\x1b[1m\x1b[47m\x1b[33m");  // bold & czerwony & biale tlo
            if(mmMode & MM_ASSERTFAIL)
                fprintf(stdout, "\x1b[3m\x1b[35m");   // kursywa & magenta
            if(mmMode & MM_DEBUGMSG)
                fprintf(stdout, "\x1b[3m\x1b[32m");    // kursywa & zielony
            fprintf(stdout, "%s\x1b[0m", sMessage.c_str());
        }

        static void RawPrint(const std::string &sMessage)
        {
            printf("\x1b[0m%s", sMessage.c_str());
        }
    };
}

#endif // CONIOLOG_HELPER_H

